//
//  TDHomeTableViewController.swift
//  微博
//
//  Created by tong dan on 16/2/29.
//  Copyright © 2016年 tong dan. All rights reserved.
//

import UIKit

class TDHomeTableViewController: TDVisitorViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        if visitorView  != nil{
        
        visitorView?.setInfo(nil, message: "关注一些人，回这里看看有什么惊喜关注一些人，回这里看看有什么惊喜")
        
            return
        }
        
        
        setupUI()
        
        //加载首页数据
        loadData()
       
    }
    
    
    
    //请求首页数据
    private func loadData(){
    
    let urlString = "https://api.weibo.com/2/statuses/friends_timeline.json"
    
    let params = [
        
        "access_token":TDUserAccountViewModel.shareViewModel.accessToken!
        ]
    //发送请求
       TDNetworkTools.sharedTools.request(urlString: urlString, parameters: params) { (response, error) -> () in
        if error != nil {
        
        print(error)
        
            return
        }
        

    }
        
    }
    
    

//设置视图内容
    private func setupUI(){
    
    navigationItem.leftBarButtonItem = UIBarButtonItem(imageNamed: "navigationbar_friendsearch", target: nil, action: "")
    navigationItem.rightBarButtonItem = UIBarButtonItem(imageNamed: "navigationbar_pop", target: self, action: "pop")
    
    
    }
    
     // MARK: - 监听方法
    @objc private func pop(){
    
    let vc = TDTempViewController()
    
        navigationController?.pushViewController(vc, animated: true)
    }
}
